var mongoose = require('mongoose');
// var settings = require('../settings');
// mongoose.connect(settings.db);
mongoose.connect('mongodb://localhost/wise');
var User = require('../models').User;
var crypto = require('crypto');


var generatePwd = function(pwd){
  return crypto.createHash('sha256').update(pwd).digest('base64').toString();
}

// User.find({"name":"admin"},function(err,user){
//   console.log(user)
// })
admin = new User({name:"admin",
                  password:generatePwd("admin"),
                  admin: true
                })

admin.save(function(){
  mongoose.disconnect()
})
